<?php
include_once 'app/until/GetData.php';

class UserPageExplorer extends GetData{

	public $daten;
	public $expire_time = 3600;
	private $aktion;

	public function __construct($match){
		$this->daten = $match;
	}

	public function getWort(RainTPL $design){
		$this->design = $design;			
		parent::GetData();	
		
        $user_page_static = new Db_user_page_static();
	    if (isset($this->daten['StaticId_del'])) {
			if($user_page_static->delStaticPage($this->daten['StaticId_del'],$this->ActivUser->id)){
				$this->aktion = '1 Seite wurde gelöscht';
			}else{
				$this->aktion = 'Id '.$this->daten['StaticId_del']. ' konnte nicht gelöscht werden';
			}
			$this->expire_time = 0;
	   	 	$this->design->assign ('aktion',$this->aktion);
		}
		
		if( $cache = $this->design->cache( $this->design->ln.'/User/Page/Explorer', $this->expire_time,$this->ActivUser->id ) )
		{
			echo $cache;
		}
		else
		{
            $crumb = new Crumb($design,2);
            
            $navi = $user_page_static->getNavi("Webseiten","Deine Seiten");		
    		$this->design->assign ('navi',$navi);
    		$user_page_explorer = new Db_user_page_explorer();
    		$this->design->assign ('css', "userpageexplorer");
            $this->design->assign ('js', "jsHome");
    		$this->design->assign ('bcrumb',$crumb->getCrumb());
    		$this->design->assign ('bcn', $crumb->getCrumb_Name());
    	    $this->design->assign ('pages',$user_page_explorer->getExplorer($this->ActivUser->id));
	    
		 	$this->design->draw( $this->design->ln.'/User/Page/Explorer');
		 }
	}
}
?>